package ar.com.fiuba.domain.impl;

import ar.com.fiuba.domain.Word;
import ar.com.fiuba.domain.api.NgrammFactory;
import ar.com.fiuba.domain.api.WordFactory;
import ar.com.fiuba.domain.exceptions.DomainException;

/**
 * Concrete class for the word factory.
 * 
 */
public class WordFactoryImpl implements WordFactory {

	private Integer ngrammLengthForWords;

	private NgrammFactory ngrammFactory;

	/**
	 * Constructor.
	 * 
	 * @param ngrammLengthForWords
	 *            length of n-gramms to be generated in the word.
	 */
	public WordFactoryImpl(Integer ngrammLengthForWords, NgrammFactory ngrammFactory) {
		this.ngrammLengthForWords = ngrammLengthForWords;
		this.ngrammFactory = ngrammFactory;
	}

	public Word makeWord(String value) throws DomainException {
		return new Word(value, ngrammLengthForWords, ngrammFactory);
	}

}
